<template>
	<view class="container">
		<view class="buy_top">
			<view class="title">
				<view class="cheng colorfff" style="background: url(../../static/equity_img/circle.png);background-repeat: no-repeat;background-size: 100% 100%;">诚</view>
				<text class="bold color5b font30">诚信买卖</text>
			</view>
			<view class="dan_count font26">
				已成交<text style="color: #676884;margin: 0 6upx;">84</text>单
			</view>
			<view class="imgs m_t6">
				<image src="../../static/equity_img/ali.png" mode=""></image>
				<image src="../../static/equity_img/wx.png" mode=""></image>
			</view>
		</view>
		<view class="buy_cen font32">
			<view class="price">
				<text>价格</text>
				<text class="m_l60">{{otc.price}}</text>
			</view>
			<view class="buyCount">
				<text>购买数量</text>
				<input class="m_t30" type="number" placeholder-style="color:#cbcbda" placeholder="请输入100的整数倍" value="" @blur="blur" @input="blur"/>
			</view>
			<view class="money">
				<text>金额</text>
				<text class="m_l60">{{otc.totalPrice}}</text>
			</view>
		</view>
		<view class="buy_bot m_t60">
			<button class="font30" type="primary" @tap="payMoney">确定付款</button>
		</view>
	</view>
</template>

<script>
	export default {
		data () {
			return {
				otc: {
					"price": 7.025,
					"count": 0,
					"totalPrice": 0
				}
			}
		},
		methods: {
			blur(e) {
				this.otc.count = e.detail.value;
				this.otc.totalPrice =  this.otc.price * this.otc.count;
			},
			payMoney() {
				if(this.otc.count == 0 || this.otc.totalPrice == 0){
					return;
				} else {
					uni.navigateTo({
						url:"./pay"
					})
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		height: 100vh;
		background: #f8f8f8;
		overflow: hidden;
		padding: 20upx 30upx;
		border-top: 1upx solid #EFEFF0;
	}
	
	.buy_top,.buy_cen {
		width: 100%;
		display: flex;
		align-items: center;
		border-radius: 10upx;
	}
	
	.buy_top {
		background: #fff;
		padding: 40upx 24upx;
		justify-content: space-between;
		.title {
			display: flex;
			align-items: center;
			font-weight: bolder;
			.cheng {
				width: 44upx;
				height: 44upx;
				display: flex;
				align-items: center;
				justify-content: center;
				margin-right: 10upx;
				font-size: 24upx;
			}
		}
		.dan_count {
			color: #b5b9c9;
		}
		.imgs {
			image {
				width: 30upx;
				height: 30upx;
				margin: 0 6upx;
			}
		}
	}
	
	.buy_cen {
		margin-top: 24upx;
		background: #fff;
		padding: 0 24upx;
		flex-direction: column;
		.price {
			width: 100%;
			padding: 30upx 0;
			border-bottom: 1upx dotted #EFEFF0;
			text:nth-of-type(1) {
				color: #9596b4;
			}
		}
		.buyCount {
			width: 100%;
			padding: 30upx 0 0 0;
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			border-bottom: 1upx solid #EFEFF0;
			input {
				padding: 10upx 0;
				font-size: 30upx;
			}
		}
		.money {
			width: 100%;
			padding: 30upx 0;
			text:nth-of-type(1) {
				color: #9596b4;
			}
		}
	}
	
	.buy_bot {
		button {
			padding: 10upx 0;
			border: none;
			background: linear-gradient(left, #3e9dff, #5e60e8);
		}
		button::after {
			border: 0;
		}
	}
</style>
